package com.avfh.netcard.controller;

import com.avfh.netcard.common.Result;
import com.avfh.netcard.model.User;
import com.avfh.netcard.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.avfh.netcard.common.BaseController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author wuhui
 * @since 2017-06-26
 */
@RestController
@RequestMapping("/api/user")
public class UserController extends BaseController {
    @Autowired
    IUserService userService;

    @RequestMapping(value = "/register", method = RequestMethod.PUT)
    public Result register(HttpServletRequest request, HttpServletResponse response, @RequestBody User user) {
        return  userService.register(user);
    }


    @GetMapping("/select")
    public void select(HttpServletRequest request, HttpServletResponse response) {
        List<User> list = userService.selectList(null);
        renderJson(response, list);
    }
}
